<template>
	<view class="pr">
		<view class="pr" style="z-index: 999;">
			<navBar :title="identity == 2 ? '取回订单' : '我的'" :placeholder='true' :autoBack='false' :leftShow='false'
				:border='false' :bgColor="identity > 2 ? '#2479D8' : '#fff'"
				:title_style="identity > 2 ? 'color:#fff':'color:#333'">
			</navBar>
		</view>

		<view class="" v-if="identity == 1">
			<userMy ref="userMy"></userMy>
		</view>
		<view class="" v-if="identity == 2">
			<serverMy ref="serverMy" :list='list'></serverMy>
		</view>
		<view class="" v-if="identity == 3">
			<PickPersonMy ref="PickPersonMy"></PickPersonMy>
		</view>
		<view class="" v-if="identity == 4">
			<storagePersonMy ref="storagePersonMy"></storagePersonMy>
		</view>

		<u-loading-page :loading="isLoading" loadingText='切换身份中'></u-loading-page>

		<pullUp :status='state'></pullUp>

		<tabbar :value="5"></tabbar>
	</view>
</template>

<script>
	import userMy from '@/components/sharePage/user/my/my.vue'
	import serverMy from '@/components/sharePage/server/my/my.vue'
	import PickPersonMy from '@/components/sharePage/PickPerson/my/my.vue'
	import storagePersonMy from '@/components/sharePage/storagePerson/my/my.vue'

	import {
		mapGetters,
		mapState
	} from 'vuex';

	import {
		pageSize
	} from '@/components/minxins.js' //引入minxins
	export default {
		mixins: [pageSize],
		components: {
			userMy,
			serverMy,
			PickPersonMy,
			storagePersonMy
		},
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.$nextTick(() => {
				if (this.identity == 1) {
					this.$refs.userMy.userStatistics()
				} else if (this.identity == 2) {
					this.getServerOrderList(6)
				}else if(this.identity == 3){
					this.$refs.PickPersonMy.pickPickings()
				}
			})
		},
		onShow() {
			this.getUser()
		},
		methods: {
			getServerOrderList(e) { //服务点订单列表
				this.method_name = 'serviceOrderList'
				this.query = {
					type: e
				}
				this.getList();
			},
		},
		computed: {
			...mapState({
				user: state => state.userInfo,
				token: state => state.token,
				identity: state => state.identity,
			}),
		},
		watch: {
			identity: {
				handler(news) {
					console.log(news, 88);
					if (news) {

					}
				},
				deep: true,
				immediate: true,
			},
		}
	}
</script>

<style lang="scss" scoped>

</style>
